import {reqCategoryData} from '../../api/category'
Page({
  data:{
    categoryList:[],
    activeIndex:0
  },

  updateActive(event){
    //得到点击时的元素序号
    const index = event.currentTarget.dataset.index
    this.setData({
      activeIndex:index
    })
  },

 async onShow(){
    const res = await reqCategoryData()
    if (res.code=== 200) {
      this.setData({
        categoryList:res.data
      })
    }
  }

})
